#-*- coding: utf-8 -*-
#! /usr/bin/python

import hashlib
import datetime


def logit(content, filename='makesnlog.txt'):
    '''
    逐行添加日志，每行一个回车
    头部是时间
    '''
    file = open(filename, 'a')
    try:
        timestr = datetime.datetime.now().strftime('%y-%m-%d %H:%M:%S')+': '
        file.write(timestr+content+'\r\n')
    finally:
        file.close()


def makesn(strs, soft='sbot'):
    '''
    soft是软件的发布版exe名字
    '''
    x = hashlib.sha224((hashlib.md5(strs)).hexdigest()+'jhfaixiaobao'+soft)
    #print x.hexdigest()
    return x.hexdigest()

print "Input the soft exe name:"
soft=raw_input()
print "Input the ww id:"
strs=raw_input()
sn = makesn(strs, soft)
logit(soft+' sale to '+strs+', SN is '+sn)
print sn
#time.sleep(10)
print 'Type any key to Exit...'
s = raw_input()
if(s):
    print 'Bye~!'
    exit()
